/* eslint-disable */
import vueBus from "../bus.js";
// vueBus.$emit("loading", true);
// vueBus.$emit("loading", false);
// import loading from "../loading.js";
// loading.start()
// loading.clear()
//get
let fn = fn => fn;
let get = function (arr) {
    let dobj = {
        "0": null,
        "1": null,
        "2": null,
        "3": null,
    }
    switch (arr.length) {
        case 1:
            return fn((obj = dobj, flag = true) => new Promise(resolve => {
                flag ? vueBus.$emit("loading", "open") : null;
                Promise.all([arr[0](obj["0"])]).then(res => {
                    vueBus.$emit("loading", "close")
                    resolve(res)
                })
            }))
        case 2:
            return fn((obj = dobj, flag = true) => new Promise(resolve => {
                flag ? vueBus.$emit("loading", "open") : null;
                Promise.all([arr[0](obj["0"]), arr[1](obj["1"])]).then(res => {
                    vueBus.$emit("loading", "close")
                    resolve(res)
                })
            }))
        case 3:
            return fn((obj = dobj, flag = true) => new Promise(resolve => {
                flag ? vueBus.$emit("loading", "open") : null;
                Promise.all([arr[0](obj["0"]), arr[1](obj["1"]), arr[2](obj["2"])]).then(res => {
                    vueBus.$emit("loading", "close")
                    resolve(res)
                })
            }))
        case 4:
            return fn((obj = dobj, flag = true) => new Promise(resolve => {
                flag ? vueBus.$emit("loading", "open") : null;
                Promise.all([arr[0](obj["0"]), arr[1](obj["1"]), arr[2](obj["2"]), arr[3](obj["3"])]).then(res => {
                    vueBus.$emit("loading", "close")
                    resolve(res)
                })
            }))
    }
}
export { get };
//
import { axios } from "../utils/request.js";
// export function getMaps() {
//     return axios({
//         url: "/v1/airport",
//         method: "get"
//     });
// }
// export function getMaps() {
//     return axios({
//         url: "/product",
//         method: "get"
//     });
// }
export function getMaps() {
    return axios({
        url: "/app/chargingNet?page=1&size=5999",
        method: "get"
    });
}

export function getColumn() {
    return axios({
        url: "/v1/column",
        method: "get"
    })
}
export function getArticle(id) {
    return axios({
        url: "/v1/article/" + id,
        method: "get"
    })
}
export function getAllArticle() {
    return axios({
        url: "/v1/article/",
        method: "get"
    })
}
export function getAirports() {
    return axios({
        url: "/v1/airports",
        method: "get"
    })
}
export function getUsers(data) {
    return axios({
        url: "/v1/user",
        method: "get",
        data: data
    })
}
// 获取台站总体统计信息
export function getStations() {
    return axios({
        url: "/v1/stations/info",
        method: "get",    
    })
}
//获取用户列表xkf
export function getUserList() {
    return axios({
        url: 'v1/station/{sid}/user',
        method: 'get',
    })  
}
//修改用户
export function editUser(dataSources) {
    return axios({
        url: '/v1/user',
        method: 'put',
        data: dataSources
    })  
}
//查询当前用户信息
export function getMineUser() {
    return axios({
        url: '/v1/user/me',
        method: 'get',
    })  
}
//添加用户
export function addUser(phone) {
    return axios({
        url: 'v1/user',
        method: 'post',
        data: phone,
        headers:{'token':sessionStorage.getItem('token')},
    })  
}
//删除用户
export function delUser(id) {
    return axios({
        url: '/v1/station/user'+ id,
        method: 'delete',
    })  
}
/* eslint-disable */